#pragma once

						
#include "IGameState.h"							// uses IGameState
#include "../SGD Wrappers/SGD_Handle.h"			// uses HTexture & HAudio
#include "../SGD Wrappers/SGD_Declarations.h"	// uses Message
#include "../SGD Wrappers/SGD_Geometry.h"
#include "../SGD Wrappers/SGD_String.h"
#include "GameCamera.h"
#include "Graph.h"




class BaseObject;
class Player;
class EntityManager;
class BehaviorManager;
class AnimationManager;
class EnemyUnit;
class SpawnDoor;

						

#include "MapManager.h"


class GameplayState : public IGameState
{
public:
	static GameplayState* GetInstance(void);
	virtual void	Enter(void)				override;	// load resources
	virtual void	Exit(void)				override;	// unload resources

	virtual bool	Input(void)				override;	// handle user input
	virtual void	Update(float elapsedTime)	override;	// update game entities / animations
	virtual void	Render(void)				override;	// render game entities / menus

	void PauseAudio(bool);

	GameCamera* GetCamera() { return &camera; }
	SGD::Size GetWorldSize() { return m_szWorldSize; }

	SGD::HAudio alarmSound = SGD::INVALID_HANDLE;
	SGD::HAudio cameraRotate = SGD::INVALID_HANDLE;
	SGD::HAudio dogBarking = SGD::INVALID_HANDLE;
	SGD::HAudio dogSniffing = SGD::INVALID_HANDLE;
	SGD::HAudio playerDeath = SGD::INVALID_HANDLE;
	SGD::HAudio aware = SGD::INVALID_HANDLE;
	SGD::HAudio cannot_use_skill = SGD::INVALID_HANDLE;
	SGD::HAudio footstep = SGD::INVALID_HANDLE;
	SGD::HTexture shadows = SGD::INVALID_HANDLE;


	//SGD::HAudio alertSound = SGD::INVALID_HANDLE;

	
	BaseObject* CreatePlayer(void);
	//void CreateSecurityCamera(void);
//	void CreateOfficer(void);
	void CreateEliteGuard(SpawnDoor* owner);
//	void CreateLightGuard(void);
//	void CreateTurret(void);
	void CreateBullet(EnemyUnit* owner);
	void CreateDog(SpawnDoor* owner);
//	void CreateDesk();
//	void CreateEnemy(int type, SGD::Point pos);
	//void CreatePickUp(int type, SGD::Point pos);
	//void CreateEnvironment(int type, SGD::Point pos);*/
	//MapManager m_tmWorld;


	//struct Node
	//{
	//	SGD::Point pos = { 0, 0 };
	//	float weight = -1;

	//};

	

private:

	GameplayState(void) = default;	// default constructor
	virtual ~GameplayState(void) = default;	// destructor

	GameplayState(const GameplayState&) = delete;	// copy constructor
	GameplayState& operator= (const GameplayState&) = delete;	// assignment operator
	
	SGD::HTexture background = SGD::INVALID_HANDLE;
	SGD::HTexture worldImages = SGD::INVALID_HANDLE;


	EntityManager*			m_pEntities = nullptr;
	AnimationManager*		m_pAnimManager = nullptr;

	BaseObject* m_pPlayer = nullptr;
	BaseObject* m_pEnemy1 = nullptr;
	BaseObject* m_pEnemy2 = nullptr;

	SGD::Rectangle testRect = SGD::Rectangle(300 , 300, 350 , 800 );
	SGD::Size m_szWorldSize = { 1024, 768 };

	GameCamera camera;

	Graph<SGD::Point*> navGraph;
	static void MessageProc(const SGD::Message* pMsg);

	vector<SGD::Rectangle*> FOVCollidables;


};

